<%@ page import="com.text.User" %><%--
  Created by IntelliJ IDEA.
  User: 86177
  Date: 2023/4/11
  Time: 10:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<body>
<%--判断用户名密码对不对 正确存起来 错误请求转发到原来的界面--%>
<%
  User user = new User();
  HttpSession session1 = request.getSession();
  String username = request.getParameter("username");
  String password = request.getParameter("password");
  if("admin".equals(username) && "123".equals(password)){
    user.setUsername(username);
    user.setPassword(password);
    session1.setAttribute("user",user);
    response.sendRedirect("messageBoard.jsp");
  }else {
    request.getRequestDispatcher("form.jsp").forward(request,response);
    System.out.println("登录错误");
  }
%>
</body>

</body>
</html>
